class gpage4 extends BaseScreen {
    public constructor() {
        super();
        this.skinName = "resource/eui_skins/page4.exml";      
    }

    private lab_totalSource:eui.Label;
    private lab_ren:eui.Label;
    private lab_par:eui.Label;
    private scroller_bg:eui.Scroller;
    private group_1:eui.Group;
    protected childrenCreated(): void {
        super.childrenCreated();
        this.init_view();
    }

    protected init_view(){

        // utils.CoreData.instance.total_source = 500;
        this.lab_totalSource.text = utils.CoreData.instance.total_source.toString();
        this.lab_ren.x = this.lab_totalSource.textWidth + this.lab_totalSource.x + 5;
        

        //百分比计算
        var stm:number = Number(egret.getOption("stm"));
        var cur_dt = new Date();
        var timestamp1 = Date.parse(cur_dt.toString())/1000; 
       
        var dayTotal:number = 300;
        var carDay:number = Math.ceil((timestamp1 - stm)/86400);
        carDay = carDay<=1?1:carDay;
        var total_source:number = carDay * dayTotal;

        var par:number = Math.floor((utils.CoreData.instance.total_source/total_source)*100);
        console.log('timestamp1='+timestamp1+'carDay='+carDay+'par='+par);
        par = par>=99?99:par;
        if(par < 15){
            par = 15 + Math.ceil(Math.random() * 10);
        }

        this.lab_par.text = par.toString();
    }

    public resize(): void {
        super.resize();
        // this.group_1.y = (this.height-this.group_1.height)*0.5;
    }
}